package com.songlanyun.modules.account.model.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.ReUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.songlanyun.common.drive.ValueObject;
import com.songlanyun.common.enums.GoodsConstant;
import com.songlanyun.common.enums.MemberConstant;
import com.songlanyun.common.utils.SpringContextUtils;
import com.songlanyun.common.utils.custom.PatternUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class AccountDownVO implements Serializable, ValueObject {

    /**
     *
     */
    private Long id;
    /**
     * 用户昵称
     */
    private String nickname;

    private String realName;
    /**
     * 昵称脱敏
     */
    public String getNicknameDesensitized()
    {
        boolean isMatch = ReUtil.isMatch("^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\\d{8}$", this.nickname);
        if(StringUtils.isNotEmpty(this.nickname) && isMatch)
        {
            return DesensitizedUtil.mobilePhone(this.nickname);
        }
        return this.nickname;
    }

    /**
     * 头像
     */
    private String headPhoto;
    /**
     * 手机号
     */
    private String mobile;


    public String getMobile()
    {
        return  PatternUtils.insensitiveOfPhone(this.mobile);
    }
    /**
     * 用户等级
     */
    private Integer level;
    /**
     * 等级编码
     */
    private String roleCode;
    /**
     * 等级编码
     */
    private String roleName;
    /**
     * 绑定时间
     */
    private Date registerTime;

    /**
     * 等级
     */
    private MemberConstant.MemberGrade grade;

    /**
     * 是否被激活
     */
    private Boolean activating = false;


}
